
public class Arrey1 {
	public int[][] a;
	
	public Arrey1(int n, int m, int k){
		a = new int[n][m];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++) {
				a[i][j] = k * (int) (Math.random() * 5);
				}
		}
	public void show() {
		System.out.println("Matrix : " + a.length
				+ " on " + a[0].length);
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++)
				System.out.print(a[i][j] + " ");
			System.out.println();
			}
		}
	
	public static void main(String[] args) {
		int n = 2, m = 3, l = 4;
		Arrey1 r = new Arrey1(n, m, l);
		Arrey1 q = new Arrey1(n, m, l);
		Arrey1 s = new Arrey1(n, m, 0);
		r.show();
		q.show();
		s.show();
		System.out.println(r.a[0].length);
		System.out.println(q.a[0].length);
		System.out.println(r.a.length);
		System.out.println(q.a.length);
		for (int i=0; i<r.a.length; i++)
			for (int j=0; j<r.a[0].length; j++)
				s.a[i][j]=r.a[i][j]+q.a[i][j];
		System.out.println("Summ: ");             
		s.show();
	}
}
